package com.itheima.exception;

import com.itheima.Pojo.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(value = Exception.class)
    public Result handleException(Exception e){
        log.error("全局异常处理器，拦截到异常",e);
        return Result.error("对不起，服务器异常，请重试");
    }
}
